<?php

class nletter {

  function nletter () {
  }

  function nlFormBegin (&$shop,$params) {
     global $shop;
     $form = '<form action="<%=$SCRIPT_NAME%>" target="'.$shop->cfgTplFrame['newsletter'].'"><input type="hidden" name="tr" value="<%=$TEMPLATE_ROOT%>"><input type="hidden" name="t" value="newsletter"><input type="hidden" name="a" value="nl"><input type="hidden" name="nlr" value="'.$params[0].'">';
     $shop->out($shop->mod['parser']->evalVars($form));
  }

  function nlEdit (&$shop,$params) {
     $shop->out('<input type="text" name="nle" '.$params[0].'>');
  }

  function nlAction (&$shop,$params) {
     if ($params[0] == 'select'){
       $shop->out('<select name="nld">'."\n".'<option value="i">'.$params[1].'</option>'."\n".'<option value="d">'.$params[2].'</option>'."\n".'</select>');
     }
     if ($params[0] == 'radio'){
       $shop->out('<input type="radio" name="nld" value="i" checked>'.$params[1].$params[3].'<input type="radio" name="nld" value="i">'.$params[2].'');
     }
  }

  function nlSubmit (&$shop,$params) {
     if ($params[0] == 'image') {
       $shop->out('<input type="image" src="'.$params[1].'" border="0">');
     } else {
       $shop->out('<input type="submit" value="'.$params[1].'" '.$params[2].'>');
     }
  }

  function nlFormEnd (&$shop) {
    $shop->out("</form>");
  }

}

?>
